package com.qf.controller;

import com.qf.pojo.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author zhaojian
 */
@RestController
@RequestMapping("/origin")
//解决跨域访问问题, 允许来自于8081服务器的请求
@CrossOrigin("http://localhost:8081")
public class CrossController {

    /**
     * 跨域访问演示方法
     * @return
     */
    @RequestMapping("/test1")
    public User test1() {
        User user = new User();
        user.setId(1);
        user.setName("演示跨域");
        user.setSex("男");
        return user;
    }

}
